<template>
	<!-- 我的团队 -->
	<view>
		<!-- #ifdef APP-PLUS -->
		<view class="status_bar"></view>  
		<!-- #endif -->
		<navbar title="我的团队" />
		<view class="toptitle">
			<text>用户信息</text>
			<text>会员等级</text>
			<text>注册时间</text>
		</view>
		<noData v-if="teamList.length===0" />
		<view class="main" v-else>
			<view class="team" v-for="(item,index) in teamList" :key="index">
				<view class="team_user">
					<image :src="item.avatar"></image>
					<text>{{item.user_name}}</text>
				</view>
				<view class="team_level">{{item.level_name}}</view>
				<view class="team_time">{{item.createtime}}</view>
			</view>
			<!-- 加载更多 -->
			<pullDownRefresh :status="loading" />
		</view>
	</view>
</template>

<script>
	import pullDownRefresh from '@/components/pullDownRefresh'
	export default {
		components:{
			pullDownRefresh
		},
		data() {
			return {
				page:1,
				teamList:[],
				loading:0
			}
		},
		onLoad() {
			this.getTeamList();
		},
		onReachBottom() {
			this.page++;
			this.getTeamList();
		},
		methods: {
			getTeamList(){
				this.loading = 1;
				this.$api.sharemypeople({offset:this.page}).then(res=>{
					if(res.length>0){
						this.loading = 0;
						this.teamList = this.teamList.concat(res);
					}else{
						this.loading = 3;
						// uni.showToast({
						// 	title:'没有更多了~',
						// 	icon:'none'
						// })
					}
				})
			}
		}
	}
</script>

<style lang="scss">
page{
	// padding-top: calc(var(--status-bar-height) + 100rpx);
}
.toptitle{
	padding: 40rpx 60rpx 40rpx 90rpx;
	@include between;
	
	text{
		font-size: 30rpx;
		font-family: Source Han Sans CN;
		font-weight: 400;
		color: #333333;
	}
}
.main{
	width: 690rpx;
	background: #FFFFFF;
	border-radius: 10rpx;
	padding: 30rpx;
	margin: 0 auto;
	
	.team{
		@include align-center;
		margin-bottom: 26rpx;
		
		&_user{
			@include align-center;
			
			image{
				width: 60rpx;
				height: 60rpx;
				border-radius: 50%;
				margin-right: 30rpx;
			}
			text{
				width: 180rpx;
				@include one;
				font-size: 24rpx;
				font-family: Source Han Sans CN;
				font-weight: 400;
				color: #333333;
			}
		}
		&_level{
			margin-right: 30rpx;
			width: 150rpx;
			@include one;
		}
		&_time{
			width: 180rpx;
			@include one;
			text-align: center;
		}
	}
}
</style>
